<?php
/**
 * 首页动态页
 *
 * @version        $Id: index.php 2 15:15 2022年3月10日Z xushubieli $
 * @package        DedeBIZ.Libraries
 * @copyright      Copyright (c) 2022, DedeBIZ.COM
 * @license        https://www.dedebiz.com/license
 * @link           https://www.dedebiz.com
 */
if(!file_exists(dirname(__FILE__).'/../data/common.inc.php')) {
    header('Location:install/index.php');
    exit();
}
if ( preg_match("#PHP (.*) Development Server#",$_SERVER['SERVER_SOFTWARE']) ) {
    if ( $_SERVER['REQUEST_URI'] == dirname($_SERVER['SCRIPT_NAME']) ) {
        header('HTTP/1.1 301 Moved Permanently');
        header('Location:'.$_SERVER['REQUEST_URI'].'/');
    }
}
//自动生成HTML版
if(isset($_GET['upcache']) || !file_exists('index.html')) {
    require_once (dirname(__FILE__)."/../system/common.inc.php");
    require_once DEDEINC."/archive/partview.class.php";
    $GLOBALS['_arclistEnv'] = 'index';
    $row = $dsql->GetOne("Select * From `#@__homepageset`");
    $row['templet'] = MfTemplet($row['templet']);
    $pv = new PartView();
    $row['templet'] =str_replace('.htm','_m.htm',$row['templet']);
    if ( !file_exists($cfg_basedir.$cfg_templets_dir."/".$row['templet']) )
    {
        echo "模板文件不存在，无法解析文档";
        exit();
    }
    $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$row['templet']);
    $pv->Display();
    exit();
    } else {
    header('HTTP/1.1 301 Moved Permanently');
    header('Location:index.html');
}
?>